'\" t
.\"     Title: ubxtool
.\"    Author: Gary E. Miller
.\" Generator: Asciidoctor 2.0.18
.\"      Date: 2023-01-10
.\"    Manual: GPSD Documentation
.\"    Source: GPSD, Version 3.25
.\"  Language: English
.\"
.TH "UBXTOOL" "1" "2023-01-10" "GPSD, Version 3.25" "GPSD Documentation"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
ubxtool \- u\-blox tool
.SH "SYNOPSIS"
.sp
\fBubxtool\fP [OPTIONS} [server[:port[:device]]]
.sp
\fBubxtool\fP \-h
.sp
\fBubxtool\fP \-V
.SH "DESCRIPTION"
.sp
\fBubxtool\fP is a tool for u\-blox GPS. If you do not have a u\-blox GPS then
you can stop reading now.
.sp
This tool operates with your u\-blox GPS at a very low level. To
understand \fBubxtool\fP you must first be familiar with your u\-blox GPS and
the documentation for the u\-blox binary protocol. The u\-blox protocol
varies greatly depending on GPS model and firmware revision. Use the
u\-blox documentation for your model and firmware.
.sp
\fBubxtool\fP can decode common u\-blox binary messages, poll the GPS status,
enable and disable GPS features, and send user generated commands to the
GPS. It can read binary messages from a file. It can read and write
directly through a serial device, or through a running \fBgpsd\fP instance.
.sp
\fBubxtool\fP does not require root privileges, except maybe to access the
serial port in direct access mode (\fB\-f FILE\fP). It will run fine as root.
Running under sudo will cause loss of functionality.
.SH "OPTIONS"
.sp
The program accepts the following options:
.sp
\fB\-?\fP, \fB\-h\fP, \fB\-\-help\fP
.RS 4
Makes \fBubxtool\fP print a usage message and exit. Use with \fB\-v 2\fP to see
all enable/disable and preset values. Use with \fB\-v 3\fP to
additionally see all configuration items (long).
.RE
.sp
\fB\-c COMMAND\fP, \fB\-\-command COMMAND\fP
.RS 4
Send a command to the GPS. Accepts one parameter, COMMAND, a
comma\-separated list of hexadecimal bytes specifying the class, the
ID, and any needed payload. The header, length, and checksum are added
automatically.
.RE
.sp
\fB\-\-device DEVICE\fP
.RS 4
The DEVICE on the \fBgpsd\fP to connect to. Defaults to all.
.RE
.sp
\fB\-d OPTION\fP, \fB\-\-disable OPTION\fP
.RS 4
Disable an option in the GPS. Accepts one parameter, OPTION, the
option to disable. Run "ubxtool \-h \-v 2" to see all possible OPTIONs. A few
possible OPTIONs are:
.sp
BEIDOU
.RS 4
Disable use of the BeiDou (COMPASS) constellation.
.RE
.sp
BINARY
.RS 4
Disable sending of the basic binary messages.
.RE
.sp
ECEF
.RS 4
Disable sending of ECEF binary messages.
.RE
.sp
GALILEO
.RS 4
Disable use of the GALILEO constellation.
.RE
.sp
GLONASS
.RS 4
Disable use of the GLONASS constellation.
.RE
.sp
GPS
.RS 4
Disable use of the GPS and QZSS constellations.
.RE
.sp
NED
.RS 4
Disable sending of NED binary messages. UBX\-NAV\-VELNED and
UBX\-NAV\-RELPOSNED.
.RE
.sp
NMEA
.RS 4
Disable sending basic NMEA messages. The messages are GBS, GGA, GSA,
GGL, GST, GSV, RMC, VTG, and ZDA.
.RE
.sp
PPS
.RS 4
Disable TIMEPULSE 0.
.RE
.sp
RAWX
.RS 4
Disable sending of the UBX\-RXM\-RAWX messages.
.RE
.sp
SBAS
.RS 4
Disable use of the SBAS constellation.
.RE
.sp
SFRBX
.RS 4
Disable use of the SFRBX messages.
.RE
.sp
SURVEYIN
.RS 4
Disable survey\-in mode with TMODE2.
.RE
.sp
TP
.RS 4
Disable sending UBX\-TIM\-TP.
.RE
.RE
.sp
\fB\-e OPTION\fP, \fB\-\-enable OPTION\fP
.RS 4
Enable an option in the GPS. Accepts one parameter, OPTION, the option
to enable. \fB\-e\fP accepts the same OPTIONs as \fB\-d\fP, except the
action is to enable the option.
.RE
.sp
\fB\-f FILE\fP, \fB\-\-file FILE\fP
.RS 4
Connect directly to a file or device. Accepts one parameter, FILE, the
file or device to open. Files are opened read\-only. Character devices
are opened read/write, unless the \fB\-r\fP parameter is given. Requires
the pyserial module.
.RE
.sp
\fB\-g ITEM,LAYER,POSITION,END\fP, \fB\-\-getitem ITEM,LAYER,POSITION,END\fP
.RS 4
Get the value of ITEM from LAYER, starting at POSITION, up to END
key/value pairs (UBX\-CFG\-VALGET). All parameters past ITEM are
optional and decimal. If LAYER is absent, then layers 0, 1, 2 and 7
are all requested. See the section on CONFIGURATION ITEMS
.RE
.sp
\fB\-\-host HOST\fP
.RS 4
Connect to the \fBgpsd\fP on HOST (server). Defaults to localhost.
.RE
.sp
\fB\-i port\fP, \fB\-\-portid port\fP
.RS 4
Specifies port ID # (interface) for port\-related commands such as
UBX_CFG\-PRT.
.RE
.sp
\fB\-p PRESET\fP, \fB\-\-preset PRESET\fP
.RS 4
Send a preset command to the GPS. Usually accepts one parameter, PRESET,
the name of the command to send. A few PRESETS, like LOG\-FINDTIME,
accept additional comma separated parameters. More than one \-p may be
used.
.RE
.sp
Only the common PRESETS are shown here. To see the full list,
including optional parameters, run "ubxtool \-h \-v 2".
.sp
COLDBOOT
.RS 4
Coldboot the GPS (UBX\-CFG\-RST).
.RE
.sp
HOTBOOT
.RS 4
Hotboot the GPS (UBX\-CFG\-RST).
.RE
.sp
MODEL,model
.RS 4
Configure the Dynamic Platform Model to model. (UBX\-CFG\-NAV5). Model
is the decimal number of the desired mode.
.RE
.sp
PMS
.RS 4
Set power management settings (UBX\-CFG\-PMS). "PMS,pow" where pow is
powerSetupValue.
.RE
.sp
RATE
.RS 4
Set measurement and nav rate (UBX\-CFG\-RATE). "RATE,meas,nav" meas is
the measRate in milli seconds. The nav argument is the navRate in
cycles and defaults to 1.
.RE
.sp
RESET
.RS 4
Reset configuration to defaults (UBX\-CFG\-CFG).
.RE
.sp
SAVE
.RS 4
Save current configuration (UBX\-CFG\-CFG).
.RE
.sp
MON\-RESETODO
.RS 4
Reset the odometer (UBX\-MON\-RESETODO).
.RE
.sp
MON\-VER
.RS 4
Poll GPS version (UBX\-MON\-VER).
.RE
.sp
WARMBOOT
.RS 4
Warmboot the GPS (UBX\-CFG\-RST).
.RE
.sp
Most PRESET parameters are simple poll commands. They merely poll the
GPS to respond with the associated message. For example "ubxtool \-p
CFG\-GNSS" asks the GPS to respond with a UBX\-CFG\-GNSS message
describing the current GNSS configuration. Increase the verbosity of
the output by adding the "\-v 2" or "\-v 3" options.
.sp
\fB\-\-port PORT\fP
.RS 4
Use PORT to connect to \fBgpsd\fP. Defaults to 2947.
.RE
.sp
\fB\-P protver\fP, \fB\-\-protver protver\fP
.RS 4
Sets the protocol version to use for sending commands. Minimum 6
(Antaris 4). Use "ubxtool \-p MON\-VER" to see the version your receiver
supports. Many newer u\-blox receivers will fail silently or oddly if
this is not set correctly. Default 10 (u\-blox 5).
.RE
.sp
\fB\-r\fP, \fB\-readonly\fP
.RS 4
Read only. Do not send anything to the GPS.
.RE
.sp
\fB\-R RAW\fP, \fB\-\-rawfile RAW\fP
.RS 4
Save all raw serial data received from the GPS into the file RAW.
.RE
.sp
\fB\-s SPEED\fP, \fB\-\-inspeed SPEED\fP
.RS 4
Set local serial port speed to SPEED bps. Default 9,600 bps.
.RE
.sp
\fB\-S SPEED\fP, \fB\-\-setspeed SPEED\fP
.RS 4
Set the GPS serial port speed to SPEED bps.
.RE
.sp
\fB\-t\fP, \fB\-\-timestamp\fP
.RS 4
Timestamp decoded messages with seconds since the epoch. Use it twice
and also get UTC time.
.RE
.sp
\fB\-v VERBOSITY\fP, \fB\-\-verbosity VERBOSITY\fP
.RS 4
Set verbosity level to VERBOSITY. Verbosity can be from 0 (very
quiet), 2 (decode messages), to 4 (very noisy). Default 1.
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Print \fBubxtool\fP version and exit.
.RE
.sp
\fB\-w WAIT\fP, \fB\-\-wait WAIT\fP
.RS 4
Wait for WAIT seconds before exiting. Use 0 to wait forever.
Default 2 seconds.
.RE
.sp
\fB\-x ITEM,LAYERS\fP, \fB\-\-delitem ITEM,LAYERS\fP
.RS 4
Delete the value of ITEM name from LAYERS. The bit map LAYERS is
optional. By default, delete in both the BBR and FLASH layers in the
receiver (UBX_CFG\-VALDEL). Returning to the reciver default for that
item. See the section on CONFIGURATION ITEMS
.RE
.sp
\fB\-z ITEM,VAL,LAYERS\fP, \fB\-\-setitem ITEM,VAL,LAYERS\fP
.RS 4
Set the value of ITEM name to VAL in LAYERS in the GPS
(UBX\-CFG\-VALSET). VAL and the bit mask LAYERS are decimal. ",LAYERS"
is optional. The default LAYERS are RAM and FLASH. See the section on
CONFIGURATION ITEMS
.RE
.SH "ARGUMENTS"
.sp
By default, clients collect data from the local \fBgpsd\fP daemon running
on localhost, using the default GPSD port 2947. The optional argument
to any client may override this behavior: \fB[server[:port[:device]]]\fP
.sp
For further explanation, and examples, see the \fBARGUMENTS\fP section in
the \fBgps\fP(1) man page
.SH "CONFIGURATION ITEMS"
.sp
Configuring u\-blox GPS with the traditional configuration messages is
fraught with problems. Many configuration messages interact in odd ways.
Something as simple as changing the serial port speed requires you to
read the current configuration using UBX\-CFG\-PRT for the proper port,
merging in the change, the writing back the changed UBX\-CFG\-PRT message.
Or just guessing at the current configuration and overwriting it all.
.sp
The u\-blox 9 series, protocol version 27+, tries, but does not
completely succeed, to solve the problem with Configuration Items. If
your GPS does not support protocol version 27+, then this section does
not apply to you.
.sp
Most of the configuration variables in the GPS have been assigned a
32\-bit Key ID. Each Key references one specific value. A typical
receiver may have over 1,100 Key IDs. Each Key ID has been assigned a
Key Name. Most of the Key Names are documented by u\-blox and supported
by \fBubxtool\fP. To see all the Key Name understood by \fBubxtool\fP run: "ubxtool
\-h \-v 3".
.sp
To get the value related to an item, use "\-g ITEM".
.sp
To reset the value related to an item to it default value, use "\-x
ITEM".
.sp
To set an ITEM name to a value, use "\-z ITEM,VAL".
.sp
If you only want to set an ITEM in one layer, use "\-z ITEM,VAL,LAYER".
.sp
See the EXAMPLES section for concrete examples.
.SH "EXAMPLES"
.sp
All examples assume that UBXOPTS is set with the protocol version of
your receiver. Be sure to replace the "\-P 18" with your correct
prototype version.
.sp
.if n .RS 4
.nf
.fam C
export UBXOPTS="\-P 18"
.fam
.fi
.if n .RE
.sp
Dump configuration and status of the GNSS recceiver. The "\-w 4" is to
provide extra time for the operations to complete.
.sp
.if n .RS 4
.nf
.fam C
ubxtool \-p CONFIG \-p STATUS \-w 4 \-v 2
.fam
.fi
.if n .RE
.sp
Decode raw log file:
.sp
.if n .RS 4
.nf
.fam C
ubxtool \-r \-f ublox\-neo\-m8n.log
.fam
.fi
.if n .RE
.sp
Change GPS port speed of device on /dev/ttyAMA0 to 230,400 bps:
.sp
.if n .RS 4
.nf
.fam C
ubxtool \-S 230400 \-f /dev/ttyAMA0
.fam
.fi
.if n .RE
.sp
Watch entire GPS reset cycle, include $GPTXT messages:
.sp
.if n .RS 4
.nf
.fam C
ubxtool \-p COLDBOOT \-w 20 \-v 2
.fam
.fi
.if n .RE
.sp
Poll Enabled Constellations:
.sp
.if n .RS 4
.nf
.fam C
ubxtool \-p CFG\-GNSS
.fam
.fi
.if n .RE
.sp
Dump \fBgpsd\fP data from a remote server named x.example.com:
.sp
.if n .RS 4
.nf
.fam C
ubxtool \-w 5 x.example.com
.fam
.fi
.if n .RE
.SS "CFG\-TP5"
.sp
Some of the "\-p" and "\-\-preset" commands can take multiple options.  One of
these is "\-\-preset CFG\-TP5".
.sp
Synopsis:
.sp
.if n .RS 4
.nf
.fam C
\-p CFG\-TP5,[tpIdx = 0],[antCableDelay = 2],[rfGroupDelay = 0],[freqPeriod = 1000000],[freqPeriodLock = 1000000],[pulseLenRatio = 0],[pulseLenRatioLock = 100000],[userConfigDelay = 0],[flags = 0x77]
.fam
.fi
.if n .RE
.sp
Leave a positional parameter empty for it to take the default value.
.sp
To set the pulse period to 0.25 s and its length to 0.1 s:
.sp
.if n .RS 4
.nf
.fam C
$ ubxtool \-p CFG\-TP5,,,,250000,250000,100000,100000
.fam
.fi
.if n .RE
.sp
To set the pulse period to 0.1 s and length to 0.1 s in the presence of lock:
.sp
.if n .RS 4
.nf
.fam C
$ ubxtool \-p CFG\-TP5,,,,,100000,,50000
.fam
.fi
.if n .RE
.SS "Version 27+ examples"
.sp
The following examples require a GPS supporting protocol 27 or greater.
Be sure to set your protocol version first:
.sp
.if n .RS 4
.nf
.fam C
    export UBXOPTS="\-P 32"
.fam
.fi
.if n .RE
.sp
To check the current dynamic model, change it to 6 (AIR1, Airborne with
<1g acceleration), revert to the default setting, and verify the faults
was restored.
.sp
.if n .RS 4
.nf
.fam C
$ ubxtool \-g CFG\-NAVSPG\-DYNMODEL
[...]
UBX\-CFG\-VALGET:
 version 1 layer 0 reserved 0,0
  layers (ram)
    item CFG\-NAVSPG\-DYNMODEL/0x20110021 val 2
[...]
$ ubxtool \-z CFG\-NAVSPG\-DYNMODEL,6
[...]
UBX\-ACK\-ACK:
 ACK to Class x6 (CFG) ID x8a (VALSET)
[...]
$ ubxtool \-g CFG\-NAVSPG\-DYNMODEL
[...]
UBX\-CFG\-VALGET:
 version 1 layer 0 reserved 0,0
  layers (ram)
    item CFG\-NAVSPG\-DYNMODEL/0x20110021 val 6
[...]
$ ubxtool \-x CFG\-NAVSPG\-DYNMODEL
[...]
UBX\-ACK\-ACK:
 ACK to Class x6 (CFG) ID x8c (VALDEL)
[...]
$ ubxtool \-g CFG\-NAVSPG\-DYNMODEL
[...]
UBX\-CFG\-VALGET:
 version 1 layer 0 reserved 0,0
  layers (ram)
    item CFG\-NAVSPG\-DYNMODEL/0x20110021 val 6
.fam
.fi
.if n .RE
.sp
Notice that the current DYNMODEL stayed at 6 (AIR1). The "\-x" only
affects the saved setting, not the current setting. To change the
current setting you must set it with "\-z".
.sp
Getting all the Configuration Items in a group one by one could be very
tedious. VAL\-GET allows you to wild card the item number and dump all
the items in a group. To get all the CFG\-TP items in ram, the currently
active ones, you can do this:
.sp
.if n .RS 4
.nf
.fam C
$ ubxtool \-g CFG\-TP,0
[...]
UBX\-CFG\-VALGET:
 version 1 layer 0 position 0
  layers (ram)
    item CFG\-TP\-TP1_ENA/0x10050007 val 1
    item CFG\-TP\-SYNC_GNSS_TP1/0x10050008 val 1
    item CFG\-TP\-USE_LOCKED_TP1/0x10050009 val 1
[...]
.fam
.fi
.if n .RE
.sp
The truly masochistic can dump all the Configuration Items by
wildcarding the group. Dumping all 1,000+ of them, 64 at a time, could
still be tedious. The \-g parameter optionally allows you to specify the
starting position to get from, as well as the ending position. To get
all the known, and unknown, items supported by the receiver that are
currently in ram:
.sp
.if n .RS 4
.nf
.fam C
$ ubxtool \-g CFG,0,0,1200 | fgrep "item CFG\-"
    item CFG\-1\-1/0x10010001 val 0
    item CFG\-1\-1/0x10010101 val 0
    item CFG\-4\-1/0x10040001 val 1
    item CFG\-4\-2/0x10040002 val 0
    item CFG\-4\-3/0x10040003 val 0
    item CFG\-4\-4/0x10040004 val 0
    item CFG\-4\-9/0x10040009 val 0
    item CFG\-TP\-TP1_ENA/0x10050007 val 1
    item CFG\-TP\-SYNC_GNSS_TP1/0x10050008 val 1
[...]
.fam
.fi
.if n .RE
.sp
Changing CFG,0,0,1200 to CFG,7,0,1200 would instead dump all the
configuration defaults, from the Default layer (7).
.SH "ENVIRONMENT"
.sp
Options can be placed in the UBXOPTS environment variable. UBXOPTS is
processed before the CLI options.
.SH "RETURN VALUES"
.sp
\fB0\fP
.RS 4
on success.
.RE
.sp
\fB1\fP
.RS 4
on failure
.RE
.SH "SEE ALSO"
.sp
\fBubxtool\fP is written to conform to the official u\-blox documentation for
the u\-blox binary protocol.
.URL "https://www.u\-blox.com/en/product\-resources" "" ""
.sp
\fBgpsd\fP(8), \fBgpsctl\fP(1), \fBgps\fP(1)
.SH "RESOURCES"
.sp
\fBProject web site:\fP \c
.URL "https://gpsd.io/" "" ""
.SH "COPYING"
.sp
This file is Copyright 2013 by the GPSD project
.br
SPDX\-License\-Identifier: BSD\-2\-clause
.SH "AUTHOR"
.sp
Gary E. Miller